home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / doom / quake1.zip / GRNDFEST.ZIP / CLIENT.QC next >
Text File  |  1996-09-17  |  34KB  |  1,450 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float    intermission_running;
  21. float    intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35. // remove items
  36.     self.items = self.items - (self.items & 
  37.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  38.     
  39. // cap super health
  40.     if (self.health > 100)
  41.         self.health = 100;
  42.     if (self.health < 50)
  43.         self.health = 50;
  44.     parm1 = self.items;
  45.     parm2 = self.health;
  46.     parm3 = self.armorvalue;
  47.     if (self.ammo_shells < 25)
  48.         parm4 = 25;
  49.     else
  50.         parm4 = self.ammo_shells;
  51.     parm5 = self.ammo_nails;
  52.     parm6 = self.ammo_rockets;
  53.     parm7 = self.ammo_cells;
  54.     parm8 = self.weapon;
  55.     parm9 = self.armortype * 100;
  56. };
  57.  
  58. // ### grenades mod ###
  59. void() SetNewParms =
  60. {
  61.    parm1 = IT_ARMOR3 | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_AXE;
  62.     parm2 = 100;
  63.    parm3 = 200;
  64.    parm4 = 10;
  65.    parm5 = 0;
  66.    parm6 = 0;
  67.    parm6 = 15;
  68.    parm8 = IT_GRENADE_LAUNCHER;
  69.    parm9 = 80;
  70. /*
  71.     parm2 = 100;
  72.     parm3 = 0;
  73.    parm4 = 15;
  74.    parm5 = 0;
  75.    parm6 = 0;
  76.     parm6 = 0;
  77.     parm8 = 1;
  78.     parm9 = 0;
  79. */
  80. };
  81.  
  82. void() DecodeLevelParms =
  83. {
  84.     if (serverflags)
  85.     {
  86.         if (world.model == "maps/start.bsp")
  87.             SetNewParms ();        // take away all stuff on starting new episode
  88.     }
  89.     
  90.     self.items = parm1;
  91.     self.health = parm2;
  92.     self.armorvalue = parm3;
  93.     self.ammo_shells = parm4;
  94.     self.ammo_nails = parm5;
  95.     self.ammo_rockets = parm6;
  96.     self.ammo_cells = parm7;
  97.     self.weapon = parm8;
  98.     self.armortype = parm9 * 0.01;
  99. };
  100.  
  101. /*
  102. ============
  103. FindIntermission
  104.  
  105. Returns the entity to view from
  106. ============
  107. */
  108. entity() FindIntermission =
  109. {
  110.     local    entity spot;
  111.     local    float cyc;
  112.  
  113. // look for info_intermission first
  114.     spot = find (world, classname, "info_intermission");
  115.     if (spot)
  116.     {    // pick a random one
  117.         cyc = random() * 4;
  118.         while (cyc > 1)
  119.         {
  120.             spot = find (spot, classname, "info_intermission");
  121.             if (!spot)
  122.                 spot = find (spot, classname, "info_intermission");
  123.             cyc = cyc - 1;
  124.         }
  125.         return spot;
  126.     }
  127.  
  128. // then look for the start position
  129.     spot = find (world, classname, "info_player_start");
  130.     if (spot)
  131.         return spot;
  132.     
  133. // testinfo_player_start is only found in regioned levels
  134.     spot = find (world, classname, "testplayerstart");
  135.     if (spot)
  136.         return spot;
  137.     
  138.     objerror ("FindIntermission: no spot");
  139. };
  140.  
  141.  
  142. string nextmap;
  143. void() GotoNextMap =
  144. {
  145.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  146.         changelevel (mapname);
  147.     else
  148.         changelevel (nextmap);
  149. };
  150.  
  151.  
  152. void() ExitIntermission =
  153. {
  154. // skip any text in deathmatch
  155.     if (deathmatch)
  156.     {
  157.         GotoNextMap ();
  158.         return;
  159.     }
  160.     
  161.     intermission_exittime = time + 1;
  162.     intermission_running = intermission_running + 1;
  163.  
  164. //
  165. // run some text if at the end of an episode
  166. //
  167.     if (intermission_running == 2)
  168.     {
  169.         if (world.model == "maps/e1m7.bsp")
  170.         {
  171.             WriteByte (MSG_ALL, SVC_CDTRACK);
  172.             WriteByte (MSG_ALL, 2);
  173.             WriteByte (MSG_ALL, 3);
  174.             if (!cvar("registered"))
  175.             {
  176.                 WriteByte (MSG_ALL, SVC_FINALE);
  177.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  178.             }
  179.             else
  180.             {
  181.                 WriteByte (MSG_ALL, SVC_FINALE);
  182.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  183.             }
  184.             return;
  185.         }
  186.         else if (world.model == "maps/e2m6.bsp")
  187.         {
  188.             WriteByte (MSG_ALL, SVC_CDTRACK);
  189.             WriteByte (MSG_ALL, 2);
  190.             WriteByte (MSG_ALL, 3);
  191.  
  192.             WriteByte (MSG_ALL, SVC_FINALE);
  193.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  194.             return;
  195.         }
  196.         else if (world.model == "maps/e3m6.bsp")
  197.         {
  198.             WriteByte (MSG_ALL, SVC_CDTRACK);
  199.             WriteByte (MSG_ALL, 2);
  200.             WriteByte (MSG_ALL, 3);
  201.  
  202.             WriteByte (MSG_ALL, SVC_FINALE);
  203.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  204.             return;
  205.         }
  206.         else if (world.model == "maps/e4m7.bsp")
  207.         {
  208.             WriteByte (MSG_ALL, SVC_CDTRACK);
  209.             WriteByte (MSG_ALL, 2);
  210.             WriteByte (MSG_ALL, 3);
  211.  
  212.             WriteByte (MSG_ALL, SVC_FINALE);
  213.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  214.             return;
  215.         }
  216.  
  217.         GotoNextMap();
  218.     }
  219.     
  220.     if (intermission_running == 3)
  221.     {
  222.         if (!cvar("registered"))
  223.         {    // shareware episode has been completed, go to sell screen
  224.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  225.             return;
  226.         }
  227.         
  228.         if ( (serverflags&15) == 15)
  229.         {
  230.             WriteByte (MSG_ALL, SVC_FINALE);
  231.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  232.             return;
  233.         }
  234.         
  235.     }
  236.  
  237.     GotoNextMap();
  238. };
  239.  
  240. /*
  241. ============
  242. IntermissionThink
  243.  
  244. When the player presses attack or jump, change to the next level
  245. ============
  246. */
  247. void() IntermissionThink =
  248. {
  249.     if (time < intermission_exittime)
  250.         return;
  251.  
  252.     if (!self.button0 && !self.button1 && !self.button2)
  253.         return;
  254.     
  255.     ExitIntermission ();
  256. };
  257.  
  258. void() execute_changelevel =
  259. {
  260.     local entity    pos;
  261.  
  262.     intermission_running = 1;
  263.     
  264. // enforce a wait time before allowing changelevel
  265.     if (deathmatch)
  266.         intermission_exittime = time + 5;
  267.     else
  268.         intermission_exittime = time + 2;
  269.  
  270.     WriteByte (MSG_ALL, SVC_CDTRACK);
  271.     WriteByte (MSG_ALL, 3);
  272.     WriteByte (MSG_ALL, 3);
  273.     
  274.     pos = FindIntermission ();
  275.  
  276.     other = find (world, classname, "player");
  277.     while (other != world)
  278.     {
  279.         other.view_ofs = '0 0 0';
  280.         other.angles = other.v_angle = pos.mangle;
  281.         other.fixangle = TRUE;        // turn this way immediately
  282.         other.nextthink = time + 0.5;
  283.         other.takedamage = DAMAGE_NO;
  284.         other.solid = SOLID_NOT;
  285.         other.movetype = MOVETYPE_NONE;
  286.         other.modelindex = 0;
  287.         setorigin (other, pos.origin);
  288.         other = find (other, classname, "player");
  289.     }    
  290.  
  291.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  292. };
  293.  
  294.  
  295. void() changelevel_touch =
  296. {
  297.     local entity    pos;
  298.  
  299.     if (other.classname != "player")
  300.         return;
  301.  
  302.     if (cvar("noexit"))
  303.     {
  304.         T_Damage (other, self, self, 50000);
  305.         return;
  306.     }
  307.     bprint (other.netname);
  308.     bprint (" exited the level\n");
  309.     
  310.     nextmap = self.map;
  311.  
  312.     SUB_UseTargets ();
  313.  
  314.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  315.     {    // NO_INTERMISSION
  316.         GotoNextMap();
  317.         return;
  318.     }
  319.     
  320.     self.touch = SUB_Null;
  321.  
  322. // we can't move people right now, because touch functions are called
  323. // in the middle of C movement code, so set a think time to do it
  324.     self.think = execute_changelevel;
  325.     self.nextthink = time + 0.1;
  326. };
  327.  
  328. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  329. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  330. */
  331. void() trigger_changelevel =
  332. {
  333.     if (!self.map)
  334.         objerror ("chagnelevel trigger doesn't have map");
  335.     
  336.     InitTrigger ();
  337.     self.touch = changelevel_touch;
  338. };
  339.  
  340.  
  341. /*
  342. =============================================================================
  343.  
  344.                 PLAYER GAME EDGE FUNCTIONS
  345.  
  346. =============================================================================
  347. */
  348.  
  349. void() set_suicide_frame;
  350.  
  351. // called by ClientKill and DeadThink
  352. void() respawn =
  353. {
  354.     if (coop)
  355.     {
  356.         // make a copy of the dead body for appearances sake
  357.         CopyToBodyQue (self);
  358.         // get the spawn parms as they were at level start
  359.         setspawnparms (self);
  360.         // respawn        
  361.         PutClientInServer ();
  362.     }
  363.     else if (deathmatch)
  364.     {
  365.         // make a copy of the dead body for appearances sake
  366.         CopyToBodyQue (self);
  367.         // set default spawn parms
  368.         SetNewParms ();
  369.         // respawn        
  370.         PutClientInServer ();
  371.     }
  372.     else
  373.     {    // restart the entire server
  374.         localcmd ("restart\n");
  375.     }
  376. };
  377.  
  378.  
  379. /*
  380. ============
  381. ClientKill
  382.  
  383. Player entered the suicide command
  384. ============
  385. */
  386. void() ClientKill =
  387. {
  388.     bprint (self.netname);
  389.     bprint (" suicides\n");
  390.     set_suicide_frame ();
  391.     self.modelindex = modelindex_player;
  392.     self.frags = self.frags - 2;    // extra penalty
  393.     respawn ();
  394. };
  395.  
  396. float(vector v) CheckSpawnPoint =
  397. {
  398.     return FALSE;
  399. };
  400.  
  401. /*
  402. ============
  403. SelectSpawnPoint
  404.  
  405. Returns the entity to spawn at
  406. ============
  407. */
  408. entity() SelectSpawnPoint =
  409. {
  410.     local    entity spot;
  411.     
  412. // testinfo_player_start is only found in regioned levels
  413.     spot = find (world, classname, "testplayerstart");
  414.     if (spot)
  415.         return spot;
  416.         
  417. // choose a info_player_deathmatch point
  418.     if (coop)
  419.     {
  420.         lastspawn = find(lastspawn, classname, "info_player_coop");
  421.         if (lastspawn == world)
  422.             lastspawn = find (lastspawn, classname, "info_player_start");
  423.         if (lastspawn != world)
  424.             return lastspawn;
  425.     }
  426.     else if (deathmatch)
  427.     {
  428.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  429.         if (lastspawn == world)
  430.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  431.         if (lastspawn != world)
  432.             return lastspawn;
  433.     }
  434.  
  435.     if (serverflags)
  436.     {    // return with a rune to start
  437.         spot = find (world, classname, "info_player_start2");
  438.         if (spot)
  439.             return spot;
  440.     }
  441.     
  442.     spot = find (world, classname, "info_player_start");
  443.     if (!spot)
  444.         error ("PutClientInServer: no info_player_start on level");
  445.     
  446.     return spot;
  447. };
  448.  
  449. /*
  450. ===========
  451. PutClientInServer
  452.  
  453. called each time a player is spawned
  454. ============
  455. */
  456. void() DecodeLevelParms;
  457. void() PlayerDie;
  458.  
  459.  
  460. void() PutClientInServer =
  461. {
  462.     local    entity spot;
  463.  
  464.     self.classname = "player";
  465.     self.health = 100;
  466.     self.takedamage = DAMAGE_AIM;
  467.     self.solid = SOLID_SLIDEBOX;
  468.     self.movetype = MOVETYPE_WALK;
  469.     self.show_hostile = 0;
  470.     self.max_health = 100;
  471.     self.flags = FL_CLIENT;
  472.     self.air_finished = time + 12;
  473.     self.dmg = 2;           // initial water damage
  474.     self.super_damage_finished = 0;
  475.     self.radsuit_finished = 0;
  476.     self.invisible_finished = 0;
  477.     self.invincible_finished = 0;
  478.     self.effects = 0;
  479.     self.invincible_time = 0;
  480.  
  481.     DecodeLevelParms ();
  482.     
  483.     W_SetCurrentAmmo ();
  484.  
  485.     self.attack_finished = time;
  486.     self.th_pain = player_pain;
  487.     self.th_die = PlayerDie;
  488.     
  489.     self.deadflag = DEAD_NO;
  490. // paustime is set by teleporters to keep the player from moving a while
  491.     self.pausetime = 0;
  492.     
  493.     spot = SelectSpawnPoint ();
  494.  
  495.     self.origin = spot.origin + '0 0 1';
  496.     self.angles = spot.angles;
  497.     self.fixangle = TRUE;        // turn this way immediately
  498.  
  499. // oh, this is a hack!
  500.     setmodel (self, "progs/eyes.mdl");
  501.     modelindex_eyes = self.modelindex;
  502.  
  503.     setmodel (self, "progs/player.mdl");
  504.     modelindex_player = self.modelindex;
  505.  
  506.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  507.     
  508.     self.view_ofs = '0 0 22';
  509.  
  510.     player_stand1 ();
  511.     
  512.     if (deathmatch || coop)
  513.     {
  514.         makevectors(self.angles);
  515.         spawn_tfog (self.origin + v_forward*20);
  516.     }
  517.  
  518.     spawn_tdeath (self.origin, self);
  519. };
  520.  
  521.  
  522. /*
  523. =============================================================================
  524.  
  525.                 QUAKED FUNCTIONS
  526.  
  527. =============================================================================
  528. */
  529.  
  530.  
  531. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  532. The normal starting point for a level.
  533. */
  534. void() info_player_start =
  535. {
  536. };
  537.  
  538.  
  539. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  540. Only used on start map for the return point from an episode.
  541. */
  542. void() info_player_start2 =
  543. {
  544. };
  545.  
  546.  
  547. /*
  548. saved out by quaked in region mode
  549. */
  550. void() testplayerstart =
  551. {
  552. };
  553.  
  554. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  555. potential spawning position for deathmatch games
  556. */
  557. void() info_player_deathmatch =
  558. {
  559. };
  560.  
  561. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  562. potential spawning position for coop games
  563. */
  564. void() info_player_coop =
  565. {
  566. };
  567.  
  568. /*
  569. ===============================================================================
  570.  
  571. RULES
  572.  
  573. ===============================================================================
  574. */
  575.  
  576. void(entity c) PrintClientScore =
  577. {
  578.     if (c.frags > -10 && c.frags < 0)
  579.         bprint (" ");
  580.     else if (c.frags >= 0)
  581.     {
  582.         if (c.frags < 100)
  583.             bprint (" ");
  584.         if (c.frags < 10)
  585.             bprint (" ");
  586.     }
  587.     bprint (ftos(c.frags));
  588.     bprint (" ");
  589.     bprint (c.netname);
  590.     bprint ("\n");
  591. };
  592.  
  593. void() DumpScore =
  594. {
  595.     local entity    e, sort, walk;
  596.  
  597.     if (world.chain)
  598.         error ("DumpScore: world.chain is set");
  599.  
  600. // build a sorted lis
  601.     e = find(world, classname, "player");
  602.     sort = world;
  603.     while (e)
  604.     {
  605.         if (!sort)
  606.         {
  607.             sort = e;
  608.             e.chain = world;
  609.         }
  610.         else
  611.         {
  612.             if (e.frags > sort.frags)
  613.             {
  614.                 e.chain = sort;
  615.                 sort = e;
  616.             }
  617.             else
  618.             {
  619.                 walk = sort;
  620.                 do
  621.                 {
  622.                     if (!walk.chain)
  623.                     {
  624.                         e.chain = world;
  625.                         walk.chain = e;
  626.                     }
  627.                     else if (walk.chain.frags < e.frags)
  628.                     {
  629.                         e.chain = walk.chain;
  630.                         walk.chain = e;
  631.                     }
  632.                     else
  633.                         walk = walk.chain;
  634.                 } while (walk.chain != e);
  635.             }
  636.         }
  637.         
  638.         e = find(e, classname, "player");
  639.     }
  640.  
  641. // print the list
  642.     
  643.     bprint ("\n");    
  644.     while (sort)
  645.     {
  646.         PrintClientScore (sort);
  647.         sort = sort.chain;
  648.     }
  649.     bprint ("\n");
  650. };
  651.  
  652. /*
  653. go to the next level for deathmatch
  654. */
  655. void() NextLevel =
  656. {
  657.     local entity o;
  658.  
  659. // find a trigger changelevel
  660.     o = find(world, classname, "trigger_changelevel");
  661.     if (!o || mapname == "start")
  662.     {    // go back to same map if no trigger_changelevel
  663.         o = spawn();
  664.         o.map = mapname;
  665.     }
  666.  
  667.     nextmap = o.map;
  668.     
  669.     if (o.nextthink < time)
  670.     {
  671.         o.think = execute_changelevel;
  672.         o.nextthink = time + 0.1;
  673.     }
  674. };
  675.  
  676. /*
  677. ============
  678. CheckRules
  679.  
  680. Exit deathmatch games upon conditions
  681. ============
  682. */
  683. void() CheckRules =
  684. {
  685.     local    float        timelimit;
  686.     local    float        fraglimit;
  687.     
  688.     if (gameover)    // someone else quit the game already
  689.         return;
  690.         
  691.     timelimit = cvar("timelimit") * 60;
  692.     fraglimit = cvar("fraglimit");
  693.     
  694.     if (timelimit && time >= timelimit)
  695.     {
  696. NextLevel ();
  697. /*
  698.         gameover = TRUE;
  699.         bprint ("\n\n\n==============================\n");
  700.         bprint ("game exited after ");
  701.         bprint (ftos(timelimit/60));
  702.         bprint (" minutes\n");
  703.         DumpScore ();
  704.         localcmd ("killserver\n");
  705. */
  706.         return;
  707.     }
  708.     
  709.     if (fraglimit && self.frags >= fraglimit)
  710.     {
  711. NextLevel ();
  712. /*
  713.         gameover = TRUE;
  714.         bprint ("\n\n\n==============================\n");
  715.         bprint ("game exited after ");
  716.         bprint (ftos(self.frags));
  717.         bprint (" frags\n");
  718.         DumpScore ();
  719.         localcmd ("killserver\n");
  720. */
  721.         return;
  722.     }    
  723. };
  724.  
  725. //============================================================================
  726.  
  727. void() PlayerDeathThink =
  728. {
  729.     local entity    old_self;
  730.     local float        forward;
  731.  
  732.     if ((self.flags & FL_ONGROUND))
  733.     {
  734.         forward = vlen (self.velocity);
  735.         forward = forward - 20;
  736.         if (forward <= 0)
  737.             self.velocity = '0 0 0';
  738.         else    
  739.             self.velocity = forward * normalize(self.velocity);
  740.     }
  741.  
  742. // wait for all buttons released
  743.     if (self.deadflag == DEAD_DEAD)
  744.     {
  745.         if (self.button2 || self.button1 || self.button0)
  746.             return;
  747.         self.deadflag = DEAD_RESPAWNABLE;
  748.         return;
  749.     }
  750.  
  751. // wait for any button down
  752.     if (!self.button2 && !self.button1 && !self.button0)
  753.         return;
  754.  
  755.     self.button0 = 0;
  756.     self.button1 = 0;
  757.     self.button2 = 0;
  758.     respawn();
  759. };
  760.  
  761.  
  762. void() PlayerJump =
  763. {
  764.     local vector start, end;
  765.     
  766.     if (self.flags & FL_WATERJUMP)
  767.         return;
  768.     
  769.     if (self.waterlevel >= 2)
  770.     {
  771.         if (self.watertype == CONTENT_WATER)
  772.             self.velocity_z = 100;
  773.         else if (self.watertype == CONTENT_SLIME)
  774.             self.velocity_z = 80;
  775.         else
  776.             self.velocity_z = 50;
  777.  
  778. // play swiming sound
  779.         if (self.swim_flag < time)
  780.         {
  781.             self.swim_flag = time + 1;
  782.             if (random() < 0.5)
  783.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  784.             else
  785.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  786.         }
  787.  
  788.         return;
  789.     }
  790.  
  791.     if (!(self.flags & FL_ONGROUND))
  792.         return;
  793.  
  794.     if ( !(self.flags & FL_JUMPRELEASED) )
  795.         return;        // don't pogo stick
  796.  
  797.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  798.  
  799.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  800.     
  801.     self.button2 = 0;
  802. // player jumping sound
  803.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  804.     self.velocity_z = self.velocity_z + 270;
  805. };
  806.  
  807.  
  808. /*
  809. ===========
  810. WaterMove
  811.  
  812. ============
  813. */
  814. .float    dmgtime;
  815.  
  816. void() WaterMove =
  817. {
  818. //dprint (ftos(self.waterlevel));
  819.     if (self.movetype == MOVETYPE_NOCLIP)
  820.         return;
  821.     if (self.health < 0)
  822.         return;
  823.  
  824.     if (self.waterlevel != 3)
  825.     {
  826.         if (self.air_finished < time)
  827.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  828.         else if (self.air_finished < time + 9)
  829.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  830.         self.air_finished = time + 12;
  831.         self.dmg = 2;
  832.     }
  833.     else if (self.air_finished < time)
  834.     {    // drown!
  835.         if (self.pain_finished < time)
  836.         {
  837.             self.dmg = self.dmg + 2;
  838.             if (self.dmg > 15)
  839.                 self.dmg = 10;
  840.             T_Damage (self, world, world, self.dmg);
  841.             self.pain_finished = time + 1;
  842.         }
  843.     }
  844.     
  845.     if (!self.waterlevel)
  846.     {
  847.         if (self.flags & FL_INWATER)
  848.         {    
  849.             // play leave water sound
  850.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  851.             self.flags = self.flags - FL_INWATER;
  852.         }
  853.         return;
  854.     }
  855.  
  856.     if (self.watertype == CONTENT_LAVA)
  857.     {    // do damage
  858.         if (self.dmgtime < time)
  859.         {
  860.             if (self.radsuit_finished > time)
  861.                 self.dmgtime = time + 1;
  862.             else
  863.                 self.dmgtime = time + 0.2;
  864.  
  865.             T_Damage (self, world, world, 10*self.waterlevel);
  866.         }
  867.     }
  868.     else if (self.watertype == CONTENT_SLIME)
  869.     {    // do damage
  870.         if (self.dmgtime < time && self.radsuit_finished < time)
  871.         {
  872.             self.dmgtime = time + 1;
  873.             T_Damage (self, world, world, 4*self.waterlevel);
  874.         }
  875.     }
  876.     
  877.     if ( !(self.flags & FL_INWATER) )
  878.     {    
  879.  
  880. // player enter water sound
  881.  
  882.         if (self.watertype == CONTENT_LAVA)
  883.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  884.         if (self.watertype == CONTENT_WATER)
  885.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  886.         if (self.watertype == CONTENT_SLIME)
  887.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  888.  
  889.         self.flags = self.flags + FL_INWATER;
  890.         self.dmgtime = 0;
  891.     }
  892.     
  893.     if (! (self.flags & FL_WATERJUMP) )
  894.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  895. };
  896.  
  897. void() CheckWaterJump =
  898. {
  899.     local vector start, end;
  900.  
  901. // check for a jump-out-of-water
  902.     makevectors (self.angles);
  903.     start = self.origin;
  904.     start_z = start_z + 8; 
  905.     v_forward_z = 0;
  906.     normalize(v_forward);
  907.     end = start + v_forward*24;
  908.     traceline (start, end, TRUE, self);
  909.     if (trace_fraction < 1)
  910.     {    // solid at waist
  911.         start_z = start_z + self.maxs_z - 8;
  912.         end = start + v_forward*24;
  913.         self.movedir = trace_plane_normal * -50;
  914.         traceline (start, end, TRUE, self);
  915.         if (trace_fraction == 1)
  916.         {    // open at eye level
  917.             self.flags = self.flags | FL_WATERJUMP;
  918.             self.velocity_z = 225;
  919.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  920.             self.teleport_time = time + 2;    // safety net
  921.             return;
  922.         }
  923.     }
  924. };
  925.  
  926.  
  927. /*
  928. ================
  929. PlayerPreThink
  930.  
  931. Called every frame before physics are run
  932. ================
  933. */
  934. void() PlayerPreThink =
  935. {
  936.     local    float    mspeed, aspeed;
  937.     local    float    r;
  938.  
  939.     if (intermission_running)
  940.     {
  941.         IntermissionThink ();    // otherwise a button could be missed between
  942.         return;                    // the think tics
  943.     }
  944.  
  945.     if (self.view_ofs == '0 0 0')
  946.         return;        // intermission or finale
  947.  
  948.     makevectors (self.v_angle);        // is this still used
  949.  
  950.     CheckRules ();
  951.     WaterMove ();
  952.  
  953.     if (self.waterlevel == 2)
  954.         CheckWaterJump ();
  955.  
  956.     if (self.deadflag >= DEAD_DEAD)
  957.     {
  958.         PlayerDeathThink ();
  959.         return;
  960.     }
  961.     
  962.     if (self.deadflag == DEAD_DYING)
  963.         return;    // dying, so do nothing
  964.  
  965.     if (self.button2)
  966.     {
  967.         PlayerJump ();
  968.     }
  969.     else
  970.         self.flags = self.flags | FL_JUMPRELEASED;
  971.  
  972. // teleporters can force a non-moving pause time    
  973.     if (time < self.pausetime)
  974.         self.velocity = '0 0 0';
  975. };
  976.     
  977. /*
  978. ================
  979. CheckPowerups
  980.  
  981. Check for turning off powerups
  982. ================
  983. */
  984. void() CheckPowerups =
  985. {
  986.     if (self.health <= 0)
  987.         return;
  988.  
  989. // invisibility
  990.     if (self.invisible_finished)
  991.     {
  992. // sound and screen flash when items starts to run out
  993.         if (self.invisible_sound < time)
  994.         {
  995.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  996.             self.invisible_sound = time + ((random() * 3) + 1);
  997.         }
  998.  
  999.  
  1000.         if (self.invisible_finished < time + 3)
  1001.         {
  1002.             if (self.invisible_time == 1)
  1003.             {
  1004.                 sprint (self, "Ring of Shadows magic is fading\n");
  1005.                 stuffcmd (self, "bf\n");
  1006.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1007.                 self.invisible_time = time + 1;
  1008.             }
  1009.             
  1010.             if (self.invisible_time < time)
  1011.             {
  1012.                 self.invisible_time = time + 1;
  1013.                 stuffcmd (self, "bf\n");
  1014.             }
  1015.         }
  1016.  
  1017.         if (self.invisible_finished < time)
  1018.         {    // just stopped
  1019.             self.items = self.items - IT_INVISIBILITY;
  1020.             self.invisible_finished = 0;
  1021.             self.invisible_time = 0;
  1022.         }
  1023.         
  1024.     // use the eyes
  1025.         self.frame = 0;
  1026.         self.modelindex = modelindex_eyes;
  1027.     }
  1028.     else
  1029.         self.modelindex = modelindex_player;    // don't use eyes
  1030.  
  1031. // invincibility
  1032.     if (self.invincible_finished)
  1033.     {
  1034. // sound and screen flash when items starts to run out
  1035.         if (self.invincible_finished < time + 3)
  1036.         {
  1037.             if (self.invincible_time == 1)
  1038.             {
  1039.                 sprint (self, "Protection is almost burned out\n");
  1040.                 stuffcmd (self, "bf\n");
  1041.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1042.                 self.invincible_time = time + 1;
  1043.             }
  1044.             
  1045.             if (self.invincible_time < time)
  1046.             {
  1047.                 self.invincible_time = time + 1;
  1048.                 stuffcmd (self, "bf\n");
  1049.             }
  1050.         }
  1051.         
  1052.         if (self.invincible_finished < time)
  1053.         {    // just stopped
  1054.             self.items = self.items - IT_INVULNERABILITY;
  1055.             self.invincible_time = 0;
  1056.             self.invincible_finished = 0;
  1057.         }
  1058.         if (self.invincible_finished > time)
  1059.             self.effects = self.effects | EF_DIMLIGHT;
  1060.         else
  1061.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1062.     }
  1063.  
  1064. // super damage
  1065.     if (self.super_damage_finished)
  1066.     {
  1067.  
  1068. // sound and screen flash when items starts to run out
  1069.  
  1070.         if (self.super_damage_finished < time + 3)
  1071.         {
  1072.             if (self.super_time == 1)
  1073.             {
  1074.                 sprint (self, "Quad Damage is wearing off\n");
  1075.                 stuffcmd (self, "bf\n");
  1076.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1077.                 self.super_time = time + 1;
  1078.             }      
  1079.             
  1080.             if (self.super_time < time)
  1081.             {
  1082.                 self.super_time = time + 1;
  1083.                 stuffcmd (self, "bf\n");
  1084.             }
  1085.         }
  1086.  
  1087.         if (self.super_damage_finished < time)
  1088.         {    // just stopped
  1089.             self.items = self.items - IT_QUAD;
  1090.             self.super_damage_finished = 0;
  1091.             self.super_time = 0;
  1092.         }
  1093.         if (self.super_damage_finished > time)
  1094.             self.effects = self.effects | EF_DIMLIGHT;
  1095.         else
  1096.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1097.     }    
  1098.  
  1099. // suit    
  1100.     if (self.radsuit_finished)
  1101.     {
  1102.         self.air_finished = time + 12;        // don't drown
  1103.  
  1104. // sound and screen flash when items starts to run out
  1105.         if (self.radsuit_finished < time + 3)
  1106.         {
  1107.             if (self.rad_time == 1)
  1108.             {
  1109.                 sprint (self, "Air supply in Biosuit expiring\n");
  1110.                 stuffcmd (self, "bf\n");
  1111.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1112.                 self.rad_time = time + 1;
  1113.             }
  1114.             
  1115.             if (self.rad_time < time)
  1116.             {
  1117.                 self.rad_time = time + 1;
  1118.                 stuffcmd (self, "bf\n");
  1119.             }
  1120.         }
  1121.  
  1122.         if (self.radsuit_finished < time)
  1123.         {    // just stopped
  1124.             self.items = self.items - IT_SUIT;
  1125.             self.rad_time = 0;
  1126.             self.radsuit_finished = 0;
  1127.         }
  1128.     }    
  1129.  
  1130. };
  1131.  
  1132.  
  1133. /*
  1134. ================
  1135. PlayerPostThink
  1136.  
  1137. Called every frame after physics are run
  1138. ================
  1139. */
  1140. void() PlayerPostThink =
  1141. {
  1142.     local    float    mspeed, aspeed;
  1143.     local    float    r;
  1144.  
  1145.     if (self.view_ofs == '0 0 0')
  1146.         return;        // intermission or finale
  1147.     if (self.deadflag)
  1148.         return;
  1149.         
  1150. // do weapon stuff
  1151.  
  1152.     W_WeaponFrame ();
  1153.  
  1154. // check to see if player landed and play landing sound    
  1155.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1156.     {
  1157.         if (self.watertype == CONTENT_WATER)
  1158.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1159.         else if (self.jump_flag < -650)
  1160.         {
  1161.             T_Damage (self, world, world, 5); 
  1162.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1163.             self.deathtype = "falling";
  1164.         }
  1165.         else
  1166.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1167.  
  1168.         self.jump_flag = 0;
  1169.     }
  1170.  
  1171.     if (!(self.flags & FL_ONGROUND))
  1172.         self.jump_flag = self.velocity_z;
  1173.  
  1174.     CheckPowerups ();
  1175. };
  1176.  
  1177.  
  1178. /*
  1179. ===========
  1180. ClientConnect
  1181.  
  1182. called when a player connects to a server
  1183. ============
  1184. */
  1185. void() ClientConnect =
  1186. {
  1187.     bprint (self.netname);
  1188.     bprint (" entered the game\n");
  1189.     
  1190. // a client connecting during an intermission can cause problems
  1191.     if (intermission_running)
  1192.         ExitIntermission ();
  1193. };
  1194.  
  1195.  
  1196. /*
  1197. ===========
  1198. ClientDisconnect
  1199.  
  1200. called when a player disconnects from a server
  1201. ============
  1202. */
  1203. void() ClientDisconnect =
  1204. {
  1205.     if (gameover)
  1206.         return;
  1207.     // if the level end trigger has been activated, just return
  1208.     // since they aren't *really* leaving
  1209.  
  1210.     // let everyone else know
  1211.     bprint (self.netname);
  1212.     bprint (" left the game with ");
  1213.     bprint (ftos(self.frags));
  1214.     bprint (" frags\n");
  1215.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1216.     set_suicide_frame ();
  1217. };
  1218.  
  1219. /*
  1220. ===========
  1221. ClientObituary
  1222.  
  1223. called when a player dies
  1224. ============
  1225. */
  1226. void(entity targ, entity attacker) ClientObituary =
  1227. {
  1228.     local    float rnum;
  1229.     local    string deathstring, deathstring2;
  1230.     rnum = random();
  1231.  
  1232.     if (targ.classname == "player")
  1233.     {
  1234.         if (attacker.classname == "teledeath")
  1235.         {
  1236.             bprint (targ.netname);
  1237.             bprint (" was telefragged by ");
  1238.             bprint (attacker.owner.netname);
  1239.             bprint ("\n");
  1240.  
  1241.             attacker.owner.frags = attacker.owner.frags + 1;
  1242.             return;
  1243.         }
  1244.  
  1245.         if (attacker.classname == "teledeath2")
  1246.         {
  1247.             bprint ("Satan's power deflects ");
  1248.             bprint (targ.netname);
  1249.             bprint ("'s telefrag\n");
  1250.  
  1251.             targ.frags = targ.frags - 1;
  1252.             return;
  1253.         }
  1254.  
  1255.         if (attacker.classname == "player")
  1256.         {
  1257.             if (targ == attacker)
  1258.             {
  1259.                 // killed self
  1260.                 attacker.frags = attacker.frags - 1;
  1261.                 bprint (targ.netname);
  1262.                 
  1263.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1264.                 {
  1265.                     bprint (" discharges into the water.\n");
  1266.                     return;
  1267.                 }
  1268.                 if (targ.weapon == 16)
  1269.                     bprint (" tries to put the pin back in\n");
  1270.                 else if (rnum)
  1271.                     bprint (" becomes bored with life\n");
  1272.                 else
  1273.                     bprint (" checks if his weapon is loaded\n");
  1274.                 return;
  1275.             }
  1276.             else
  1277.             {
  1278.                 attacker.frags = attacker.frags + 1;
  1279.  
  1280.                 rnum = attacker.weapon;
  1281.                 if (rnum == IT_AXE)
  1282.                 {
  1283.                     deathstring = " was ax-murdered by ";
  1284.                     deathstring2 = "\n";
  1285.                 }
  1286.                 if (rnum == IT_SHOTGUN)
  1287.                 {
  1288.                     deathstring = " chewed on ";
  1289.                     deathstring2 = "'s boomstick\n";
  1290.                 }
  1291.                 if (rnum == IT_SUPER_SHOTGUN)
  1292.                 {
  1293.                     deathstring = " ate 2 loads of ";
  1294.                     deathstring2 = "'s buckshot\n";
  1295.                 }
  1296.                 if (rnum == IT_NAILGUN)
  1297.                 {
  1298.                     deathstring = " was nailed by ";
  1299.                     deathstring2 = "\n";
  1300.                 }
  1301.                 if (rnum == IT_SUPER_NAILGUN)
  1302.                 {
  1303.                     deathstring = " was punctured by ";
  1304.                     deathstring2 = "\n";
  1305.                 }
  1306.                 if (rnum == IT_GRENADE_LAUNCHER)
  1307.                 {
  1308.                     deathstring = " eats ";
  1309.                     deathstring2 = "'s pineapple\n";
  1310.                     if (targ.health < -40)
  1311.                     {
  1312.                         deathstring = " was gibbed by ";
  1313.                         deathstring2 = "'s grenade\n";
  1314.                     }
  1315.                 }
  1316.                 if (rnum == IT_ROCKET_LAUNCHER)
  1317.                 {
  1318.                     deathstring = " rides ";
  1319.                     deathstring2 = "'s rocket\n";
  1320.                     if (targ.health < -40)
  1321.                     {
  1322.                         deathstring = " was gibbed by ";
  1323.                         deathstring2 = "'s rocket\n" ;
  1324.                     }
  1325.                 }
  1326.                 if (rnum == IT_LIGHTNING)
  1327.                 {
  1328.                     deathstring = " accepts ";
  1329.                     if (attacker.waterlevel > 1)
  1330.                         deathstring2 = "'s discharge\n";
  1331.                     else
  1332.                         deathstring2 = "'s shaft\n";
  1333.                 }
  1334.                 bprint (targ.netname);
  1335.                 bprint (deathstring);
  1336.                 bprint (attacker.netname);
  1337.                 bprint (deathstring2);
  1338.             }
  1339.             return;
  1340.         }
  1341.         else
  1342.         {
  1343.             targ.frags = targ.frags - 1;        // killed self
  1344.             rnum = targ.watertype;
  1345.  
  1346.             bprint (targ.netname);
  1347.             if (rnum == -3)
  1348.             {
  1349.                 if (random() < 0.5)
  1350.                     bprint (" sleeps with the fishes\n");
  1351.                 else
  1352.                     bprint (" sucks it down\n");
  1353.                 return;
  1354.             }
  1355.             else if (rnum == -4)
  1356.             {
  1357.                 if (random() < 0.5)
  1358.                     bprint (" gulped a load of slime\n");
  1359.                 else
  1360.                     bprint (" can't exist on slime alone\n");
  1361.                 return;
  1362.             }
  1363.             else if (rnum == -5)
  1364.             {
  1365.                 if (targ.health < -15)
  1366.                 {
  1367.                     bprint (" burst into flames\n");
  1368.                     return;
  1369.                 }
  1370.                 if (random() < 0.5)
  1371.                     bprint (" turned into hot slag\n");
  1372.                 else
  1373.                     bprint (" visits the Volcano God\n");
  1374.                 return;
  1375.             }
  1376.  
  1377.             if (attacker.flags & FL_MONSTER)
  1378.             {
  1379.                 if (attacker.classname == "monster_army")
  1380.                     bprint (" was shot by a Grunt\n");
  1381.                 if (attacker.classname == "monster_demon1")
  1382.                     bprint (" was eviscerated by a Fiend\n");
  1383.                 if (attacker.classname == "monster_dog")
  1384.                     bprint (" was mauled by a Rottweiler\n");
  1385.                 if (attacker.classname == "monster_dragon")
  1386.                     bprint (" was fried by a Dragon\n");
  1387.                 if (attacker.classname == "monster_enforcer")
  1388.                     bprint (" was blasted by an Enforcer\n");
  1389.                 if (attacker.classname == "monster_fish")
  1390.                     bprint (" was fed to the Rotfish\n");
  1391.                 if (attacker.classname == "monster_hell_knight")
  1392.                     bprint (" was slain by a Death Knight\n");
  1393.                 if (attacker.classname == "monster_knight")
  1394.                     bprint (" was slashed by a Knight\n");
  1395.                 if (attacker.classname == "monster_ogre")
  1396.                     bprint (" was destroyed by an Ogre\n");
  1397.                 if (attacker.classname == "monster_oldone")
  1398.                     bprint (" became one with Shub-Niggurath\n");
  1399.                 if (attacker.classname == "monster_shalrath")
  1400.                     bprint (" was exploded by a Vore\n");
  1401.                 if (attacker.classname == "monster_shambler")
  1402.                     bprint (" was smashed by a Shambler\n");
  1403.                 if (attacker.classname == "monster_tarbaby")
  1404.                     bprint (" was slimed by a Spawn\n");
  1405.                 if (attacker.classname == "monster_vomit")
  1406.                     bprint (" was vomited on by a Vomitus\n");
  1407.                 if (attacker.classname == "monster_wizard")
  1408.                     bprint (" was scragged by a Scrag\n");
  1409.                 if (attacker.classname == "monster_zombie")
  1410.                     bprint (" joins the Zombies\n");
  1411.  
  1412.                 return;
  1413.             }
  1414.             if (attacker.classname == "explo_box")
  1415.             {
  1416.                 bprint (" blew up\n");
  1417.                 return;
  1418.             }
  1419.             if (attacker.solid == SOLID_BSP && attacker != world)
  1420.             {    
  1421.                 bprint (" was squished\n");
  1422.                 return;
  1423.             }
  1424.             if (targ.deathtype == "falling")
  1425.             {
  1426.                 targ.deathtype = "";
  1427.                 bprint (" fell to his death\n");
  1428.                 return;
  1429.             }
  1430.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1431.             {
  1432.                 bprint (" was spiked\n");
  1433.                 return;
  1434.             }
  1435.             if (attacker.classname == "fireball")
  1436.             {
  1437.                 bprint (" ate a lavaball\n");
  1438.                 return;
  1439.             }
  1440.             if (attacker.classname == "trigger_changelevel")
  1441.             {
  1442.                 bprint (" tried to leave\n");
  1443.                 return;
  1444.             }
  1445.  
  1446.             bprint (" died\n");
  1447.         }
  1448.     }
  1449. };
  1450.